// 2025/10/17
// 用最少数量的箭引爆气球

class Solution {
public:
    int findMinArrowShots(vector<vector<int>>& points) {
        sort(points.begin(), points.end());
        vector<vector<int>> merged;
        for(auto& point : points)
        {
            if(merged.empty() || point[0] > merged.back()[1])
            {
                merged.push_back(point);
            }
            else
            {
                merged.back()[0] = point[0];
                merged.back()[1] = min(merged.back()[1], point[1]);
            }
        }
        return merged.size();
    }
};